package com.nj.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

@Data
public class PageResult<T> implements Serializable {
    /**
     * 总记录数
     */
    private Long total;
    /**
     * 每页的记录数
     */
    private Long size;
    /**
     * 当前页数
     */
    private Long current;
    /**
     * 总页数
     */
    private Long pages;
    /**
     * 数据集合,默认给个空数组
     */
    private List<T> records = Collections.emptyList();
    public void loan(IPage record){
        this.setPages(record.getPages());
        this.setSize(record.getSize());
        this.setCurrent(record.getCurrent());
        this.setTotal(record.getTotal());
        this.setRecords(record.getRecords());
    }
}
